<template>
  <div>
    <Myheard title="tabbar 案例"></Myheard>
    <div class="main">
      <component :is="comname"></component>
    </div>
    <Mytabbar :arr="tabList" @bian="changfn"></Mytabbar>
  </div>
</template>

<script>
import Myheard from "./components/myheader";
import Mytabbar from "./components/mytabbar.vue";

import MyGoodsList from "./view/goods";
import MyGoodsSearch from "./view/goodsear";
import MyUserInfo from "./view/userinfo";
export default {
  methods: {
    changfn(index) {
      this.comname = this.tabList[index].componentName;
    },
  },
  data() {
    return {
      comname: "MyGoodsList",
      tabList: [
        {
          iconText: "icon-shangpinliebiao",
          text: "商品列表",
          componentName: "MyGoodsList",
        },
        {
          iconText: "icon-sousuo",
          text: "商品搜索",
          componentName: "MyGoodsSearch",
        },
        {
          iconText: "icon-user",
          text: "我的信息",
          componentName: "MyUserInfo",
        },
      ],
    };
  },
  components: { Myheard, Mytabbar, MyGoodsList, MyGoodsSearch, MyUserInfo },
};
</script>

<style>
.main {
  padding: 50px 0;
}
</style>